package com.rstrulak.model;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity
@Table(name = "PROJECT")
public class Project {
	private Long id;
	private String name;
	private String description;
	private User owner;
	
	private List<Task> taskList;
//	private Long taskListSize;
	@Id
	@GeneratedValue(generator = "gen_project")
	@SequenceGenerator(name = "gen_project", sequenceName = "PROJECT_SEQ")
	@Column(name = "PROJECT_ID", nullable = false, unique = true)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "NAME", nullable = false)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "DESCRIPTION", nullable = true)
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Transient
	public List<Task> getTaskList() {
		return taskList;
	}

	public void setTaskList(List<Task> taskList) {
		this.taskList = taskList;
	}

//	@Transient
//	public Long getTaskListSize() {
//		taskListSize = taskDao.get
//		return taskListSize;
//	}
//
//	public void setTaskListSize(Long taskListSize) {
//		this.taskListSize = taskListSize;
//	}
	
	@ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "OWNER_ID", nullable = false)
	public User getOwner() {
		return owner;
	}

	public void setOwner(User owner) {
		this.owner = owner;
	}

	
	
	

}
